Emacs tricks

Insert fancy characters in emacs

For a one-off character instead: C-x 8 RET (insert-char), then either the name GREEK SMALL LETTER PI or the hex code 3c0.

Can get a pdf file (or presumably any others) to autorefresh with

auto-revert-mode

Local variables

How to control the default command of tex-compile ?

C-c C-c (tex-compile) doesn't compile the current buffer — it compiles whatever (tex-main-file) returns. That function:

  1. uses the tex-main-file variable if set (it's nil for you);
  2. else, if the current buffer contains \documentclass/\documentstyle in its first ~10k chars (tex-start-of-header), treats this buffer as the master;
  3. else calls tex-guess-main-file, which scans your other open buffers / the directory for a file that does have \documentclass, and returns the first hit.

The fix — pin tex-main-file per file. Each of your section files is its own compilable document, so a dir-local can't cover them; use a file-local block. Add to the end of researchStatement.tex:

%%% Local Variables:
%%% tex-main-file: "researchStatement.tex"
%%% End:

Two forms, both general:

  • End-of-file block (what we used): Local Variables: … End:.
  • First-line "prop line", in a comment at the very top:

    # -*- mode: python; fill-column: 100; indent-tabs-mode: nil -*-
    

AI Quotes

Can select region and do

  • C-c i a
  • <A [tab]

Delete trailing whitespace

delete trailing whitespace with: C-c w r

Links

  • Use org-insert-link for links to webpages !!!!
  • Event better ! org-cliplink C-c L get the text in clipboard (eg: kill ring and call function)

Markdown

  • C-c C-v - to open md files in Okular
  • C-c C-g - to open md files in grip-mode

Elisp

C-x C-e to execute a line of code (cursor needs to be at the end of the line)

Due Dates

To add a due date to a task in org-mode, position your cursor on the task heading and use: C-c C-d (which runs org-deadline)

Getting a code block

Use C-c C-, (or M-x org-insert-structure-template) or <s [tab]

Type C-c C-,
Type s for source block
Enter the language (e.g., shell, python, emacs-lisp)

Built-in Buffer List:

C-x C-b - Opens the buffer list in a separate window In the buffer list, you can:

d - Mark buffer for deletion x - Execute deletions RET or f - Switch to buffer o - Open buffer in other window

Quick gptsend C-c g

This gives you a quick C-c g binding that's less likely

To have one line paragraph

For the current buffer only: M-x =set-fill-column RET 80 RET Or use the key binding: C-x f 80 RET set it to 10000

TRAMS: Remote work

  • playing around with sshfs… not working
  • Trying emacs TRAMP:

/ssh:jda102@cmslpc-el9.fnal.gov:/uscms/home/jda102/nobackup/HH4b/Run3/coffea4bees/

  • works great!!

obsidian

C-c d - open daily C-c o - follow link at point C-c b - follow backlinks C-c n - open new note C-c j - jump to an existing note

Links: